\documentclass{minimal}
\usepackage{lipsum}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot} 

\newsavebox{\measuredSize}
\newcommand{\resizeToWidth}[2]{%
    \pgfmathsetmacro{\pgfplotswidth}{#2}%
    \begin{lrbox}{\measuredSize}#1\end{lrbox}%
    \pgfmathsetmacro{\pgfplotswidth}{2*\pgfplotswidth-\wd\measuredSize}%
    #1%
}

\newcommand{\inputPlot}{%
    \begin{tikzpicture}
        \begin{axis}
            [
                height=5cm,
                width=\pgfplotswidth,
                yticklabel style={align=right,inner sep=0pt,xshift=-0.3em},
                grid=both,
                max space between ticks=50,
                minor x tick num=4,
                minor y tick num=4,
                tick style={semithick,color=black}, 
                date coordinates in=x,
                xticklabel=\day.\month.
            ]
            \addplot[color = black, mark=diamond*] coordinates{
                (2009-08-07, 98) (2009-08-09, 92) (2009-08-12, 94) (2009-08-15, 87) (2009-08-19, 82) (2009-08-26, 65) (2009-08-29, 54) (2009-09-02, 31)
            };
        \end{axis}
    \end{tikzpicture}%
}

\begin{document}
    \setlength{\parindent}{0ex}

    \lipsum[1]\vspace*{2ex}

    \resizeToWidth{\inputPlot}{\textwidth}

    \vspace*{2ex}\lipsum[2]
\end{document}
